from selenium.webdriver.common.by import By

from base.page_base import BasePage


class BackLoginPage(BasePage):
    def __init__(self, driver):
        super().__init__(driver)
        self.phone = By.XPATH, '//*[@id="username"]'
        self.password = By.XPATH, '//*[@id="password"]'
        self.login1 = By.XPATH, '//*[@id="valicode"]'
        self.button = By.XPATH, '//*[@id="loginForm"]/div[4]/input'
        self.admin = By.XPATH, '//*[@id="breadcrumbs"]/div/span'
        # self.fell = By.ID, 'errorMessage'

    def back_login(self, phone, pwd, code):
        self.base_input(self.phone, phone)
        self.base_input(self.password, pwd)
        self.base_input(self.login1, code)
        self.base_click(self.button)

    def get_success(self):
        return self.fd_element(self.admin).text
    # def gte_fell(self):
    #     return self.fd_element(self.fell).text

